<!DOCTYPE html>
<html>
<head>
    <title>账户列表</title>
    <include file='public/head'>
    <style>
        .layui-legend-size{font-size:14px !important;}
        .layui-nopadding{padding:0 !important;}
        .layui-overflow{overflow:auto;}
        .layui-nomargin{margin: 0 !important;}
        .layui-bottom{border-bottom:1px solid rgb(226, 226, 226);}
        .layui-input{height:30px !important; }
        .layui-form-search-item .layui-inline{margin-bottom: 5px;} 
        .layui-form-search-item label{margin-left: 15px;}
        .layui-table-page {padding: 7px 0px 0px;}
        .layui-field-padding{border-width: 1px;padding:0 0 5px 10px;}
    </style>
</head>
<div class="layui-tab " lay-filter="demo-tab" class="js-check-wrap">
    <!-- 顶部导航菜单开始 -->
    <div class="layui-tab-nav" >
        <ul class="layui-tab-title">
            {:getNav('fund','admin_index/accountList')};
        </ul>
    </div>
    <fieldset class="layui-elem-field layui-field-title layui-field-padding">
        <legend class="layui-legend-size">搜索</legend>
        <form class="layui-form table-bar" action="{:cmf_plugin_url('Fund://admin_index/accountList')}" lay-filter="form-bar" method="post">
            <div class="layui-form-search-item">
                <label>模块名：</label>
                <div class="layui-inline ">
                    <div class="layui-input-inline " style="width: 100px;">
                        <select name="type">
                            <option value="0"  <?php if(isset($search['type']) && $search['type']==0){echo 'selected';} ?>>请选择</option>
                            <option value="1"  <?php if(isset($search['type']) && $search['type']==1){echo 'selected';} ?>>支付单号</option>
                            <option value="2"  <?php if(isset($search['type']) && $search['type']==2){echo 'selected';} ?>>用户手机</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline ">
                    <div class="layui-input-inline " style="width: 100px;">
                        <input type="text" name="category" autocomplete="off" class="layui-input" value="{$search['category']|default=''}">
                    </div>
                </div>
                <label>订单时间：</label>
                <div class="layui-inline ">
                    <div class="layui-input-inline " style="width: 100px;">
                        <input type="text" name="add_time" class="layui-input" autocomplete="off"  value="{$search['add_time']|default=''}" placeholder="开始时间">
                    </div>
                </div>
                <div class="layui-inline ">
                    <div class="layui-input-inline " style="width: 100px;">
                        <input type="text" name="end_time" class="layui-input" autocomplete="off"  value="{$search['end_time']|default=''}" placeholder="结束时间">
                    </div>
                </div>
                <div class="layui-inline">
                    <button type="submit" class="layui-btn layui-btn-sm layui-btn-primary " style="font-weight:800;" lay-submit="" lay-filter="demo2"><i class="layui-icon ">&#xe615;</i>搜索</button>
                </div>
            </div>
        </form>
    </fieldset>
    <div class="layui-card">
        <div class="layui-card-header layui-bg-gray layui-bottom">
            <a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-danger" onclick="allDelete()"><i class="layui-icon">&#xe640;</i>批量删除</a>
        </div>
        <div class="layui-card-body layui-nopadding " >
            <form method="post" id="f">
            <table  class="layui-table layui-nomargin" >
                <thead>
                    <tr>
                        <th width='20px'>
                            <input type='checkbox' id='check-box-all' class='layui-form-checkbox'>
                        </th>
                        <th align="center">用户昵称</th>
                        <th align="center">手机号</th>
                        <th align="center">账户类型</th>
                        <th align="center">支付账号</th>
                        <th align="center">添加时间</th>
                        <th align="center">是否为默认账号</th>
                        <th align="center">操作</th>
                    </tr>
                </thead>
                <volist name="list" id="vo">
                    <tr>
                        <th>
                            <input type="checkbox" class='check-box' name='id[]' value='{$vo.id}'>
                        </th>
                        <td>{$vo['nickname']}</td>
                        <td>{$vo['phone']}</td>
                        <td>{$vo['account_type']}</td>
                        <td>{$vo['account']}</td>
                        <td>{:date('Y-m-d H:i:s',$vo['addtime'])}</td>
                        <td><switch name="$vo['is_first']">
                            <case value="1"><span style="color: red;">是</span></case>
                            <case value="2"><span style="color:#1cbb9b;">否</span></case>
                        </switch></td>
                        <td>
                            <button type="button" data-id="{$vo.id}" class="layui-btn layui-btn-primary layui-btn-xs delete-btn" title="删除"><i class="layui-icon">&#xe640;</i></button>
                            <!-- <a class="btn btn-danger btn-sm js-ajax-delete" data-msg="确定删除此条订单？" href="{:cmf_plugin_url('Fund://admin_index/bankcarddelone')}?id={$vo['id']}">删除</a> -->
                        </td>
                    </tr>
                </volist>
            </table>
            </form>
            <div class="layui-table-page">
                <div id="layui-table-page1">
                    <div class="layui-box layui-laypage layui-laypage-default" id="layui-laypage-1">
                        {$page|default=''}
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<include file="public/scripts"/>
<script type="text/javascript">
//全选/取消
$('#check-box-all').on('click',function(){
    $('.check-box').prop('checked',$('#check-box-all').prop('checked'));
});
//卸载
$('.delete-btn').on('click',function(){
    var text = "确定要删除该数据？";
    let id = $(this).data('id');
    let url = "{:cmf_plugin_url('Fund://admin_index/delAccount')}";
    layer.confirm(text, {icon: 3, title:'提示', btn: ['删除','取消']}, function(index,layero){
        $.ajax({
            url:url,
            type:"post",
            data:{
                id:id
            },
            success:function(data){
                if (data.code == 1) {
                    layer.msg(data.msg,{icon:1,time:1500},function(){
                        window.location.reload();
                    });
                } else {
                    layer.msg(data.msg,{icon:2,time:1500});
                }
            },
            error:function(){
                layer.msg('系统错误',{icon:2,time:1500});
            }
        })
    },function(index){
        // alert('取消');
    });
});
//批量删除
function allDelete()
{
    var text = "确定要删除该数据？";
    let data = $('#f').serialize();
    let url = "{:cmf_plugin_url('Fund://admin_index/delAccount')}";
    layer.confirm(text, {icon: 3, title:'提示', btn: ['删除','取消']}, function(index,layero){
        $.ajax({
            url:url,
            type:"post",
            data:data,
            success:function(data){
                if (data.code == 1) {
                    layer.msg(data.msg,{icon:1,time:1500},function(){
                        window.location.reload();
                    });
                } else {
                    layer.msg(data.msg,{icon:2,time:1500});
                }
            },
            error:function(){
                layer.msg('系统错误',{icon:2,time:1500});
            }
        })
    },function(index){
        // alert('取消');
    });
}
</script>
</body>
</html>